package com.sskj.fca.ui.activity;


import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.sskj.common.base.App;
import com.sskj.common.util.ClickUtil;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.fca.R;
import com.sskj.fca.presenter.WalletAddressAddActivityPresenter;

import butterknife.BindView;

@Route(path = RConfig.APP_WALLET_ADDRESS_ADD)//钱包地址添加
public class WalletAddressAddActivity extends BaseActivity<WalletAddressAddActivityPresenter> {
    @BindView(R.id.et_wallet_address)
    EditText etWalletAddress;
    @BindView(R.id.et_wallet_msg)
    EditText etWalletMsg;
    @BindView(R.id.btn_confirm)
    Button btnConfirm;

    @Override
    protected int getLayoutResId() {
        return R.layout.app_activity_wallet_address_add;
    }

    @Override
    public WalletAddressAddActivityPresenter getPresenter() {
        return new WalletAddressAddActivityPresenter();
    }

    @Override
    protected void initView() {
        setTitle(App.INSTANCE.getString(R.string.app_activity_wallet_address_add));

        ClickUtil.click(btnConfirm, () -> {
            if (TextUtils.isEmpty(etWalletAddress.getText().toString())) {
                ToastUtil.showShort("请输入钱包地址");
                return;
            }
            if (TextUtils.isEmpty(etWalletMsg.getText().toString())) {
                ToastUtil.showShort("请输入钱包地址备注信息");
                return;
            }

            mPresenter.addWallet(etWalletAddress.getText().toString(), etWalletMsg.getText().toString());
        });
    }

    public void addSuccess() {
        finish();
    }

}
